package example.file;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;

/**
 * Created by lenovo on 2016/11/4 0004.
 * write() 方法向文件写入内容
 */
public class WriteFile {
    public static void main(String[] args) {
        try {
            BufferedWriter out = new BufferedWriter(new FileWriter("outfilename"));
            out.write("w3cschool菜鸟教程");
            out.close();
            System.out.println("文件创建成功！");
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
